<template>
  <div class="department" id="department collapse-itemContent">
    <!-- 左侧部门管理 -->
    <div class="structureTree" v-if="treelength">
      <div class="structureTree_title">
        <div>组织机构</div>
        <div></div>
      </div>
      <tree
        :treeData="treeData"
        :checkData="checkData"
        nodeKey="fCompanyid"
        @getTreeInfo="handleNodeClick"
        :defaultProps="defaultProps"
      >
      </tree>
    </div>
    <!-- 右侧 -->
    <div class="department_right">
      <!-- 机构名称 -->
      <el-breadcrumb :title="showName"></el-breadcrumb>
      <!-- 表格 -->
      <div
        class="warningObject_table tableminute collapse-itemContent"
        id="tableminute collapse-itemContent"
      >
        <el-collapse
          v-if="!pageFlag"
          v-model="activeNames"
          @change="changeCollapse"
        >
          <!-- <el-collapse-item name="0">
            <template slot="title">
              <div>
                <img
                  style="vertical-align: middle"
                  src="@/assets/img/Supervision/com_flg.png"
                  alt=""
                />
                <span style="margin-left: 8px"> 张拉预警信息接收设置 </span>
              </div>
            </template>
            <div style="margin-top: 3px; display: flex; flex-direction: column">
              <div>
                <el-table
                  :data="tableData"
                  :span-method="objectSpanMethod"
                  border
                  style="width: 100%"
                >
                  <el-table-column
                    prop="type"
                    label=""
                    align="center"
                    width="180"
                  >
                    <template slot-scope="scope">
                      <el-button
                        :type="
                          scope.row.type == 1
                            ? 'plain'
                            : scope.row.type == 2
                            ? 'warning'
                            : scope.row.type == 3
                            ? 'danger'
                            : scope.row.type == 4
                            ? 'purple'
                            : 'brown'
                        "
                        :class="
                          scope.row.type == 1
                            ? 'plain'
                            : scope.row.type == 2
                            ? 'warning'
                            : scope.row.type == 3
                            ? 'danger'
                            : scope.row.type == 4
                            ? 'purple'
                            : 'brown'
                        "
                        >{{ scope.row.type | typ1 }}</el-button
                      >
                    </template>
                  </el-table-column>

                  <el-table-column prop="name" label="报警对象" align="center">
                    <template slot-scope="scope">
                      <div class="selectobject">
                        <el-select
                          placeholder="请选择"
                          v-model="scope.row.name"
                          multiple
                          value-key="fId"
                          @change="selectEquipmen(scope.row, scope.row.name, 1)"
                        >
                          <el-option
                            v-for="(item, index) in ObjectsData"
                            :label="`${item.fObjectname}`"
                            :value="item"
                            :key="index"
                          >
                          </el-option>
                        </el-select>
                      </div>
                    </template>
                  </el-table-column>

                  <el-table-column
                    prop="amount1"
                    label="超出多少周期后不发(分钟)"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="inputminute">
                        <el-input
                          v-model="scope.row.amount1"
                          type="number"
                        ></el-input>
                      </div>
                    </template>
                  </el-table-column>

                  <el-table-column
                    prop="amount2"
                    label="是否启动"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <el-switch v-model="scope.row.amount2"> </el-switch>
                    </template>
                  </el-table-column>
                </el-table>
              </div>

              <div style="margin: 5px 0" class="shortMessageform">
                <el-form ref="form" :model="form" label-width="180px">
                  <el-form-item label="短信模板">
                    <el-input type="textarea" v-model="form.desc"></el-input>
                  </el-form-item>
                </el-form>
                <div style="margin-left: 180px; color: #f78989">
                  说明 {0}：表示“标段” {1}：表示“工程名称” {2}：表示“工程部位”
                  {3}：表示“拌合站名称” {4}：表示“拌合机名称”
                  {5}：表示“拌合机编号” {6}：表示“出料时间” {7}：表示“强度等级”
                  {8}：表示“超标等级” {9}：表示“超标结果” {10}：第一个
                </div>
              </div>
             
              <div class="saveBtn">
                <el-button
                  type="primary"
                  size="small"
                  @click="yj_editObjectForm(0)"
                >
                  保存</el-button
                >
              </div>
            </div>
          </el-collapse-item> -->

          <el-collapse-item name="0">
            <template slot="title">
              <div>
                <img
                  style="vertical-align: middle"
                  src="@/assets/img/Supervision/com_flg.png"
                  alt=""
                />
                <span style="margin-left: 8px"> 压浆预警信息接收设置 </span>
              </div>
            </template>
            <div style="margin-top: 3px">
              <div>
                <el-table
                  :data="tableData1"
                  :span-method="objectSpanMethod"
                  border
                  style="width: 100%"
                >
                  <el-table-column
                    prop="type"
                    label=""
                    align="center"
                    width="180"
                  >
                    <template slot-scope="scope">
                      <el-button
                        :type="
                          scope.row.type == 1
                            ? 'plain'
                            : scope.row.type == 2
                            ? 'warning'
                            : 'danger'
                        "
                        :class="
                          scope.row.type == 1
                            ? 'plain'
                            : scope.row.type == 2
                            ? 'warning'
                            : 'danger'
                        "
                        >{{ scope.row.type | type }}</el-button
                      >
                    </template>
                  </el-table-column>
                  <el-table-column prop="name" label="报警对象" align="center">
                    <template slot-scope="scope">
                      <div class="selectobject">
                        <el-select
                          placeholder="请选择"
                          v-model="scope.row.name"
                          multiple
                          value-key="fId"
                          @change="selectEquipmen(scope.row, scope.row.name, 2)"
                        >
                          <el-option
                            v-for="(item, index) in ObjectsData"
                            :label="`${item.fObjectname}`"
                            :value="item"
                            :key="index"
                          >
                          </el-option>
                        </el-select>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="amount1"
                    label="超出多少周期后不发(分钟)"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="inputminute">
                        <el-input
                          v-model="scope.row.amount1"
                          type="number"
                        ></el-input>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="amount2"
                    label="是否启动"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <el-switch v-model="scope.row.amount2"> </el-switch>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
              <div style="margin: 5px 0" class="shortMessageform">
                <el-form ref="form" :model="form1" label-width="180px">
                  <el-form-item label="短信模板">
                    <el-input type="textarea" v-model="form1.desc"></el-input>
                  </el-form-item>
                </el-form>
              </div>
              <div style="margin-left: 180px; color: #f78989">
                说明 {0}：表示“标段” {1}：表示“梁场名称” {2}：表示“设备名称”
                {3}：表示“梁名称” {4}：表示“工程名称” {5}：表示“压浆时间”
                {6}：表示“超标结果（几级预警、什么预警）”
              </div>
              <!-- 保存按钮 -->
              <div class="saveBtn">
                <el-button
                  type="primary"
                  size="small"
                  @click="yj_editObjectForm(1)"
                >
                  保存</el-button
                >
              </div>
            </div>
          </el-collapse-item>
        </el-collapse>
        <div v-if="pageFlag" class="pageFlag">
          <img src="@/assets/img/undata.png" alt="" />
          <div class="pageFlagText">暂时没有数据哦！</div>
          <div class="pageFlagTexts">请选择施工单位</div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import tree from "@/components/stationProductionPage/GroutManage/tree";
import elBreadcrumb from "@/components/public/el-breadcrumb.vue";
import {
  getUserCompanyTreeList, //树状图接口
  getNoticeObjectListByCompanyId, //预警通知---下拉框内容
  getNoticeTemplateByPiece, // 按盘数模版--获取（4张拉,5压浆）
  addNoticeTemplateByPiece, // 按盘数模版--新增/修改
} from "@/api/request.js";

// import { objectType, messageType } from "@/utils/config";
export default {
  name: "AlertTemplate",
  inject: ["reload"],
  data() {
    return {
      name: "AlertTemplate", //按钮配置页面代号
      // 机构树
      treelength: false, //左侧树显示隐藏
      checkData: [], //选中tree状态id
      defaultProps: {
        children: "children",
        label: "fShortname",
      },
      showName: "未选择公司",
      treeData: [], //左侧树状图数据
      fNature: "", //点击组织机构等级
      treeText: {
        //树状图参数
        companyId: null,
        userId: null,
        text: null,
      },
      // 机构树

      pageFlag: true, //判断是否在施工单位级别
      activeNames: ["0", "1"], //折叠面板

      // 张拉--参数
      addList_p: {
        fId: "", // 为空或不传时新增  有值为修改
        userId: "", // 当前用户id
        userName: "", // 当前用户name
        fCompanyid: "", // 施工标段id
        fLowobjectids: "", // 初级对象ids
        fMidobjectids: "", // 中级对象ids
        fHighobjectids: "", // 高级对象ids
        fBetterhighobjectids: "", // 四级对象ids
        fMosthighobjectids: "", // 五级对象ids
        fOvertime: "", // 超出多少周期后不发
        fIsstarted: "", // 是否启用 1 启用 0-停用
        fTexttemplate: "", // 短信模版
        fNote: "4",
      },
      tableData: [
        //  按每盘 数据
        {
          type: "1",
          name: [],
          amount1: "",
          amount2: true,
        },
        {
          type: "2",
          name: [],
          amount1: "",
          amount2: "",
        },
        {
          type: "3",
          name: [],
          amount1: "",
          amount2: "",
        },
        {
          type: "4",
          name: [],
          amount1: "",
          amount2: "",
        },
      ],
      form: {
        desc: "提示:{0} {1} {2},{3}({5}),出料时间{6},{7},{8}超差,{9}，请及时查看。",
      },
      // 张拉--参数

      // 压浆--参数
      addList_C: {
        fId: "", // 为空或不传时新增  有值为修改
        userId: "", // 当前用户id
        userName: "", // 当前用户name
        fCompanyid: "", // 施工标段id
        fLowobjectids: "", // 初级对象ids
        fMidobjectids: "", // 中级对象ids
        fHighobjectids: "", // 高级对象ids
        fOvertime: "", // 超出多少周期后不发
        fIsstarted: "", // 是否启用 1 启用 0-停用
        fTexttemplate: "", // 短信模版
        fNote: "5",
      },
      tableData1: [
        //  张拉 数据
        {
          type: "1",
          name: [],
          amount1: "",
          amount2: true,
        },
      ],
      form1: {
        desc: "提示:{0} {1} {2}{3}{4},压浆时间({5}),超差{6},请及时查看。",
      },
      // 压浆--参数

      ObjectsData: [], //报警对象下拉框
      fEquipmentname: [], //已选主要仪器设备

      getList: {
        fCompanyid: "", // 施工标段id
      },

      //   yj_add: null, //新增按钮是否显示
      //   yj_edit: null, //编辑按钮是否显示
      //   yj_view: null, //查看按钮是否显示
    };
  },
  components: {
    tree, //左侧组织机构数
    elBreadcrumb, //面包屑
  },
  filters: {
    type(val) {
      var type;
      if (val == 1) {
        type = "预警";
      } else if (val == 2) {
        type = "中级";
      } else if (val == 3) {
        type = "高级";
      }
      return type;
    },

    typ1(val) {
      var type;
      if (val == 1) {
        type = "一级";
      } else if (val == 2) {
        type = "二级";
      } else if (val == 3) {
        type = "三级";
      } else if (val == 4) {
        type = "四级";
      } else if (val == 5) {
        type = "五级";
      }
      return type;
    },
  },
  mounted() {
    this.userInfo = JSON.parse(sessionStorage.getItem("yjSmart-userInfo"));

    
    if (JSON.parse(sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck"))) {
      var id = JSON.parse(sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck"));
      this.checkData = [id.fCompanyid];
      this.getList.fCompanyid = id.fCompanyid;

      if (id.fNature == "施工单位") {
        this.pageFlag = false;
        this.yj_ObjectForm(id.fCompanyid);
        // this.getFormwork_ZL(id.fCompanyid);
        this.getFormwork_YJ(id.fCompanyid);
      } else {
        this.pageFlag = true;
      }
    }
    this.getTree();
    this.btnRole(this.name);
  },
  methods: {
    btnRole(name) {
      // 按钮权限
      var btnList = [];
      var ModuleList = JSON.parse(sessionStorage.getItem("yjSmart-ModuleList"));
      if (ModuleList.length > 0) {
        ModuleList.map((item) => {
          if (item.fEncode == name) {
            btnList = item.modulebuttonList;
          }
        });
        var btnStr = [];
        btnList.map((item) => {
          btnStr.push(item.fEncode);
        });

        this.yj_add = btnStr.includes("yj_add");
        this.yj_edit = btnStr.includes("yj_edit");
        this.yj_view = btnStr.includes("yj_view");
      } else {
        this.yj_add = true;
        this.yj_edit = true;
        this.yj_view = true;
      }
    },

    // 折叠面板
    changeCollapse(e) {
      return e;
    },

    // 昨日不合格总量进行提醒  发送时间
    timeScope(e) {
      if (e - 0 < 0) {
        this.tableData1[0].amount1 = "0";
      } else if (e - 0 > 23) {
        this.tableData1[0].amount1 = "23";
      } else {
        this.tableData1[0].amount1 = e;
      }
    },

    objectSpanMethod({ columnIndex }) {
      // 合并列
      if (columnIndex === 2 || columnIndex === 3) {
        return {
          rowspan: 5,
          colspan: 1,
        };
      }
    },
    // 左侧树结构
    getTree() {
      this.treeText = {
        companyId: this.userInfo.companyId,
        userId: this.userInfo.userId,
        text: "4", // 0其他  1 砼拌合站 2水稳 3沥青 4张拉压浆
      };
      getUserCompanyTreeList(this.treeText)
        .then((res) => {
          if (res.errcode == 0) {
            var companyTree = res.data.userCompanyTreeList;
            this.treeData = this.commonJs.tranListToTreeData(companyTree);

            if (this.treeData[0].children == undefined) {
              this.treelength = false; //左侧组织机构是否显示
            } else {
              this.treelength = true;
            }
            if (this.checkData[0]) {
              this.showName = JSON.parse(
                sessionStorage.getItem("yjSmart-TensionAndGrout_treeCheck")
              ).fShortname;
              this.addList_p.fCompanyid = this.checkData[0]; // 施工标段id
              this.addList_C.fCompanyid = this.checkData[0];
              this.addList_D.fCompanyid = this.checkData[0];
            } else {
              this.showName = this.treeData[0].fShortname; //当前点击组织机构名称
              this.checkData[0] = this.treeData[0].fCompanyid;
            }
          } else {
            this.$message.error(res.msg);
            return false;
          }
        })
        .catch(() => {
          return false;
        });
    },

    // 点击左侧机构树
    handleNodeClick(data) {
      this.showName = data.fShortname; //顶部显示机构名
      this.fNature = data.fNature;
      if (data.fNature == "施工单位") {
        this.reload();
        this.addList_p.fCompanyid = data.fCompanyid; // 按盘 施工标段id
        this.addList_C.fCompanyid = data.fCompanyid; // 按车 施工标段id

        this.pageFlag = false;
        this.getList.fCompanyid = data.fCompanyid; //当前点击组织机构ID

        this.yj_ObjectForm(data.fCompanyid);

        // this.getFormwork_ZL(data.fCompanyid);
        this.getFormwork_YJ(data.fCompanyid);
        // this.getFormwork_T(data.fCompanyid);
        // this.getFormwork_D(data.fCompanyid);
      } else {
        this.pageFlag = true;
      }
    },

    // getFormwork_ZL(id) {
    //   // 张拉--获取
    //   getNoticeTemplateByPiece({ fCompanyid: id, fNote: "4" })
    //     .then((res) => {
    //       if (res.errcode == 0) {
    //         if (res.data) {
    //           this.addList_p.fId = res.data.fId;

    //           let fLowobjectidsArr = null;
    //           this.tableData[0].name = [];
    //           fLowobjectidsArr = res.data.fLowobjectids.split(",");
    //           for (let index = 0; index < this.ObjectsData.length; index++) {
    //             const element = this.ObjectsData[index];
    //             for (let index = 0; index < fLowobjectidsArr.length; index++) {
    //               const element1 = fLowobjectidsArr[index];
    //               if (element.fId == element1) {
    //                 this.tableData[0].name.push(element);
    //               }
    //             }
    //           }

    //           let fMidobjectidsArr = null;
    //           this.tableData[1].name = [];
    //           fMidobjectidsArr = res.data.fMidobjectids.split(",");
    //           for (let index = 0; index < this.ObjectsData.length; index++) {
    //             const element = this.ObjectsData[index];
    //             for (let index = 0; index < fMidobjectidsArr.length; index++) {
    //               const element1 = fMidobjectidsArr[index];
    //               if (element.fId == element1) {
    //                 this.tableData[1].name.push(element);
    //               }
    //             }
    //           }

    //           let fHighobjectidsArr = null;
    //           this.tableData[2].name = [];
    //           fHighobjectidsArr = res.data.fHighobjectids.split(",");
    //           for (let index = 0; index < this.ObjectsData.length; index++) {
    //             const element = this.ObjectsData[index];
    //             for (let index = 0; index < fHighobjectidsArr.length; index++) {
    //               const element1 = fHighobjectidsArr[index];
    //               if (element.fId == element1) {
    //                 this.tableData[2].name.push(element);
    //               }
    //             }
    //           }

    //           let fBetterhighobjectidsArr = null;
    //           this.tableData[3].name = [];
    //           fBetterhighobjectidsArr =
    //             res.data.fBetterhighobjectids.split(",");
    //           for (let index = 0; index < this.ObjectsData.length; index++) {
    //             const element = this.ObjectsData[index];
    //             for (
    //               let index = 0;
    //               index < fBetterhighobjectidsArr.length;
    //               index++
    //             ) {
    //               const element1 = fBetterhighobjectidsArr[index];
    //               if (element.fId == element1) {
    //                 this.tableData[3].name.push(element);
    //               }
    //             }
    //           }

    //           // let fMosthighobjectidsArr = null;
    //           // this.tableData[4].name = [];
    //           // fMosthighobjectidsArr = res.data.fMosthighobjectids.split(",");
    //           // for (let index = 0; index < this.ObjectsData.length; index++) {
    //           //   const element = this.ObjectsData[index];
    //           //   for (
    //           //     let index = 0;
    //           //     index < fMosthighobjectidsArr.length;
    //           //     index++
    //           //   ) {
    //           //     const element1 = fMosthighobjectidsArr[index];
    //           //     if (element.fId == element1) {
    //           //       this.tableData[4].name.push(element);
    //           //     }
    //           //   }
    //           // }

    //           this.tableData[0].amount1 = res.data.fOvertime;

    //           if (res.data.fIsstarted == 1) {
    //             this.tableData[0].amount2 = true;
    //           } else {
    //             this.tableData[0].amount2 = false;
    //           }
    //           this.form.desc = res.data.fTexttemplate;
    //         }
    //       } else {
    //         this.$message.error(res.msg);
    //       }
    //     })
    //     .catch((error) => {
    //       console.log(error);
    //       // this.$message.error(error.msg);
    //     });
    // },
    // addFormwork_ZL(data) {
    //   // 张拉---保存
    //   addNoticeTemplateByPiece(data)
    //     .then((res) => {
    //       if (res.errcode == 0) {
    //         this.$message.success("保存成功");
    //         //  this.reload();
    //         this.getFormwork_ZL(this.getList.fCompanyid);
    //       } else {
    //         this.$message.error(res.msg);
    //       }
    //     })
    //     .catch((error) => {
    //       console.log(error);
    //     });
    // },

    getFormwork_YJ(id) {
      // 压浆--获取
      getNoticeTemplateByPiece({ fCompanyid: id, fNote: "5" })
        .then((res) => {
          if (res.errcode == 0) {
            if (res.data) {
              this.addList_C.fId = res.data.fId;
              let fLowobjectidsArr = null;
              this.tableData1[0].name = [];
              fLowobjectidsArr = res.data.fLowobjectids.split(",");
              for (let index = 0; index < this.ObjectsData.length; index++) {
                const element = this.ObjectsData[index];
                for (let index = 0; index < fLowobjectidsArr.length; index++) {
                  const element1 = fLowobjectidsArr[index];
                  if (element.fId == element1) {
                    this.tableData1[0].name.push(element);
                  }
                }
              }

              this.tableData1[0].amount1 = res.data.fOvertime;

              if (res.data.fIsstarted == 1) {
                this.tableData1[0].amount2 = true;
              } else {
                this.tableData1[0].amount2 = false;
              }
              this.form1.desc = res.data.fTexttemplate;
            }
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    addFormwork_YJ(data) {
      // 压浆--保存
      addNoticeTemplateByPiece(data)
        .then((res) => {
          if (res.errcode == 0) {
            this.$message.success("保存成功");
            this.getFormwork_YJ(this.getList.fCompanyid);
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },

    // 报警对象---下拉框内容
    yj_ObjectForm(id) {
      var data = {
        fCompanyid: id,
        fNote: "5",
      };
      getNoticeObjectListByCompanyId(data)
        .then((res) => {
          if (res.errcode == 0) {
            this.ObjectsData = res.data;
            // this.getFormwork_ZL(this.getList.fCompanyid);
            this.getFormwork_YJ(this.getList.fCompanyid);
          } else {
            this.$message.error(res.msg);

            return false;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },

    // 保存
    yj_editObjectForm(status) {
      // if (status == 0) {

      //   this.addList_p.userId = this.$store.state.userInfo.userId; // 当前用户id
      //   this.addList_p.userName = this.$store.state.userInfo.realName; // 当前用户name
      //   let fLowobjectids = "";
      //   for (let index = 0; index < this.tableData[0].name.length; index++) {
      //     const element = this.tableData[0].name[index];
      //     fLowobjectids += element.fId + ",";
      //   }
      //   this.addList_p.fLowobjectids = fLowobjectids.slice(
      //     0,
      //     fLowobjectids.length - 1
      //   ); // 初级对象ids

      //   let fMidobjectids = "";
      //   for (let index = 0; index < this.tableData[1].name.length; index++) {
      //     const element = this.tableData[1].name[index];
      //     fMidobjectids += element.fId + ",";
      //   }
      //   this.addList_p.fMidobjectids = fMidobjectids.slice(
      //     0,
      //     fMidobjectids.length - 1
      //   ); // 中级对象ids

      //   let fHighobjectids = "";
      //   for (let index = 0; index < this.tableData[2].name.length; index++) {
      //     const element = this.tableData[2].name[index];
      //     fHighobjectids += element.fId + ",";
      //   }
      //   this.addList_p.fHighobjectids = fHighobjectids.slice(
      //     0,
      //     fHighobjectids.length - 1
      //   ); // 高级对象ids

      //   let fBetterhighobjectids = "";
      //   for (let index = 0; index < this.tableData[3].name.length; index++) {
      //     const element = this.tableData[3].name[index];
      //     fBetterhighobjectids += element.fId + ",";
      //   }
      //   this.addList_p.fBetterhighobjectids = fBetterhighobjectids.slice(
      //     0,
      //     fBetterhighobjectids.length - 1
      //   ); // 四级对象ids

      //   // let fMosthighobjectids = "";
      //   // for (let index = 0; index < this.tableData[4].name.length; index++) {
      //   //   const element = this.tableData[4].name[index];
      //   //   fMosthighobjectids += element.fId + ",";
      //   // }
      //   // this.addList_p.fMosthighobjectids = fMosthighobjectids.slice(
      //   //   0,
      //   //   fMosthighobjectids.length - 1
      //   // ); // 五级对象ids

      //   this.addList_p.fOvertime = this.tableData[0].amount1; // 超出多少周期后不发
      //   if (this.tableData[0].amount2 == true) {
      //     this.addList_p.fIsstarted = "1";
      //   } else {
      //     this.addList_p.fIsstarted = "0";
      //   } // 是否启用 1 启用 0-停用

      //   this.addList_p.fTexttemplate = this.form.desc; // 短信模版
      //   this.addFormwork_ZL(this.addList_p);
      // } else
      if (status == 1) {
        this.addList_C.userId = this.userInfo.userId; // 当前用户id
        this.addList_C.userName = this.userInfo.realName; // 当前用户name
        let fLowobjectids = "";
        for (let index = 0; index < this.tableData1[0].name.length; index++) {
          const element = this.tableData1[0].name[index];
          fLowobjectids += element.fId + ",";
        }
        this.addList_C.fLowobjectids = fLowobjectids.slice(
          0,
          fLowobjectids.length - 1
        ); // 初级对象ids

        this.addList_C.fOvertime = this.tableData1[0].amount1; // 超出多少周期后不发

        if (this.tableData1[0].amount2 == true) {
          this.addList_C.fIsstarted = "1";
        } else {
          this.addList_C.fIsstarted = "0";
        } // 是否启用 1 启用 0-停用

        this.addList_C.fTexttemplate = this.form1.desc; // 短信模版
        this.addFormwork_YJ(this.addList_C);
      }
    },

    // 报警对象下拉框
    selectEquipmen() {
      // selectEquipmen(row, list,num) {
      // console.log("99",this.fEquipmentname,row,list,num);

      var arr = [];
      this.fEquipmentname.map((item) => {
        arr.push(item.fId);
      });
      // fId
      // this.formData.fObjects = arr.join(",");
    },

    // 多选方法
    selectionChange() {},
    // 排序方法
    sortChange() {},
  },
};
</script>
  
<style scoped lang="less">
.warningObject_table {
  display: flex;
  height: 100%;
}

.saveBtn {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 15px;
  padding: 7px 40px 0px;
  border-top: 1px solid #eee;
}

.collapse-itemContent {
  width: 100%;
  overflow-y: auto;
  padding: 0 10px;
  box-sizing: border-box;
}

.customTable {
  display: flex;
  height: 100%;
  justify-content: flex-end;
  align-items: center;
  padding-right: 30px;
}

.pageFlag {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;
  color: #171a1d;
  font-size: 16px;
  // background: pink;

  img {
    width: 258px;
    height: 208px;
  }

  .pageFlagText {
    margin-top: 33px;
  }

  .pageFlagTexts {
    font-size: 14px;
    color: #a2a4a7;
  }
}

.customTable /deep/.cell {
  height: 100%;
  display: flex;
  align-items: center;
}

.customTable /deep/.el-button {
  width: 25px;

  display: flex;
  justify-content: center;
  align-items: center;
}

.collapse-itemContent /deep/.el-collapse-item__content {
  padding-bottom: 7px !important;
}

.collapse-itemContent /deep/.el-input__inner {
  padding: 0 0 0 15px !important;
}

.shortMessageform /deep/.el-form-item {
  display: flex !important;
}

.shortMessageform /deep/.el-form-item__label {
  text-align: center;
}

.shortMessageform /deep/.el-form-item__content {
  margin-left: 0 !important;

  flex: 1;
}

.selectobject /deep/.el-input__icon {
  line-height: 22px;
}

.inputminute /deep/.el-input {
  width: 55px;
  margin: auto;
}
</style>